<template>
  <div>
    <Chart :cdata="cdata" />
  </div>
</template>

<script>
  import Chart from './chart.vue'
  export default {
    data () {
      return {
        cdata: {
          category: [
            "市区",
            "万州",
            "江北",
            "南岸",
            "城口",
            "彭水",
            "巫溪",
          ],
          barData: [
            7600,
            6600,
            4400,
            6150,
            2550,
            9000,
            7250
          ],
          lineData: [
            8600,
            9900,
            5400,
            7150,
            5550,
            9900,
            7850
          ],
          rateData: []
        }
      }
    },
    components: {
      Chart,
    },
    mounted () {
      this.setData();
    },
    beforeDestroy () {

    },
    methods: {
      // 根据自己的业务情况修改
      setData () {
        for (let i = 0; i < this.cdata.barData.length -1; i++) {
          let rate = this.cdata.barData[i] / this.cdata.lineData[i];
          this.cdata.rateData.push(rate.toFixed(2));
        }
      },
    }
  };
</script>

<style lang="scss" scoped>
</style>
